local sk__dujin = fk.CreateSkill {

  name = "sk__dujin",

  tags = { Skill.Compulsory, },

}



sk__dujin:addEffect(fk.TargetSpecified, {
  name = "sk__dujin",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(sk__dujin.name) and player.phase == Player.Play and data.card.trueName == "slash" then
      local n = #player.room.logic:getEventsOfScope(GameEvent.UseCard, 2, function(e)
        return e.data.from == player and e.data.card.trueName == "slash"
      end, Player.HistoryPhase)
      return n == 1
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(sk__dujin.name)
    room:notifySkillInvoked(player, sk__dujin.name, "offensive")
    data.additionalDamage = (data.additionalDamage or 0) + 1
    data.disresponsive = true
  end,
})
sk__dujin:addEffect(fk.CardEffectCancelledOut, {
  name = "sk__dujin",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(sk__dujin.name) and player.phase == Player.Play and data.card.trueName == "slash" then
      local n = #player.room.logic:getEventsOfScope(GameEvent.UseCard, 2, function(e)
        return e.data.from == player and e.data.card.trueName == "slash"
      end, Player.HistoryPhase)
      return n > 1
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(sk__dujin.name)
    room:notifySkillInvoked(player, sk__dujin.name, "negative")
    room:doIndicate(data.to, { player.id })
    room:damage {
      from = data.to,
      to = player,
      damage = 1,
      skillName = sk__dujin.name,
    }
  end,
})

sk__dujin:addEffect("targetmod", {
  name = "#sk__dujin_targetmod",
  bypass_times = function(self, player, skill, scope)
    return player:hasSkill(sk__dujin.name) and skill.trueName == "slash_skill" and scope == Player.HistoryPhase
  end,
})

return sk__dujin
